package Controllers;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

import Boundry.UserPanel;
import Boundry.WorkerPanel;

public class GUIControllerUser implements ActionListener{
	UserPanel userPanel;
	private static  GUIControllerUser Instance = null;
	
	
	private  GUIControllerUser()
	{
		
	}
	
	void inizializtion(){
		userPanel = new UserPanel();
		GlobalData.guiMangaer.switchScreen(userPanel);
		GlobalData.mainScreen = userPanel;
		
		for (Component btn: userPanel.getMainPanel().getComponents())
		{	
			if (btn instanceof JButton)
				((JButton)btn).addActionListener(this);
		}
	}
	
	
	public static GUIControllerUser getInstance()
	{
		if (Instance == null )
		{
			Instance = new GUIControllerUser();
		}
		return Instance;
	}
	
	
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if (e.getSource() == userPanel.getBtnSubmitreq()) // TODO ************** Shimon Done **************
		{
			System.out.println("UserController.getInstance().SubmitNewRequest();");
			UserController.getInstance().SubmitNewRequest();
		}
		else if (e.getSource() == userPanel.getBtnSearchReq() ) //TODO ************** Guy Done **************
		{
			System.out.println("UserController.getInstance().searchRequest();	");
			UserController.getInstance().searchRequest();	
		}
	}
	
	
	public static void main(String[] args){
		JFrame frame =  new JFrame();
		GuiManager guiMangaer = new GuiManager();
		GlobalData.guiMangaer = guiMangaer;
		
		//frame.setVisible(true);
		//frame.setBounds(0, 0, 700, 700);
		new GUIControllerUser();
		
	}

	
	
	
	
	

}
